package com.wy.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wy.common.R;

import com.wy.service.IOrderDetailService;
import com.wy.entity.OrderDetail;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 订单商品表 前端控制器
 * </p>
 *
 * @author 王昭贵
 * @since 2023-04-23
 */
@RestController
@RequestMapping("/order-detail")
public class OrderDetailController {

    @Resource
    private IOrderDetailService orderDetailService;

    // 新增或者更新
    @PostMapping
    public R save(@RequestBody OrderDetail orderDetail) {
        orderDetailService.saveOrUpdate(orderDetail);
        return R.success("");
    }

    @GetMapping
    public R findAll() {
        return R.success(orderDetailService.list());
    }

    @GetMapping("/{id}")
    public R findOne(@PathVariable Integer id) {
        return R.success(orderDetailService.getById(id));
    }



}

